/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.sun.hunk.util;

import java.text.DecimalFormat;
import java.text.NumberFormat;

/**
 *
 * @author sunil
 */
public class NumberUtil {

    public static String formatNumber(Object number, String pattern) {
        try {
            NumberFormat numberFormat = new DecimalFormat(pattern);
            return numberFormat.format(number);
        } catch (NumberFormatException e) {
            return null;
        } catch (IllegalArgumentException e) {
            return null;
        }
    }
}
